#include "precompiled.h"
#include "SineProducer.h"
#include <cmath>
#include <cassert>
#include "../common.h"

namespace AudioEngine
{
	SineProducer::SineProducer(double pitch)
	{
		assert(pitch > 0);
		this->pitch = pitch;
	}

	/*override*/ float SineProducer::get_sample(int index) const
	{
		return (1 / 4.0) * std::sin(index * 2 * pi * pitch / sample_rate);
	}

	void SineProducer::set_pitch(double pitch)
	{
		this->pitch = pitch;
	}

	double SineProducer::get_pitch() const
	{
		return pitch;
	}
}
